/**
 * BootstrapingFactory.java
 * ************************** 
 * @date Apr 26, 2011
 * @author Michele Tamburini
 * 
 * **************************
 */
package gossipServices.bootstraping.theBootstrapingService;

import networkRmi.NetworkManager;
import systems.network.NetworkSystemsAPI;
import gossipServices.basic.view.ConcretePartialView;
import gossipServices.basic.view.PartialView;
import gossipServices.network.NetworkServicesAPI;
import gossipServices.pss.PeerSamplingService;
import gossipServices.pss.PeerSamplingServiceAPI;

/**
 * Description: 
 *
 */
public class BootstrapingFactory {
	
	private static final long BOOTSTRAPING_CYCLE_LENGTH = 1000;//ms

	private Bootstraping bootstraping;

	private PartialView bootstrapingView;
	private NetworkServicesAPI nsa;
	private PeerSamplingServiceAPI pss;
	
	public BootstrapingFactory(ConcretePartialView view,
			PeerSamplingService pss, NetworkManager networkManager ){
		
		this.nsa = new BootstrapingNetworkManager(networkManager);
		this.bootstrapingView = view;
		this.pss = pss;
		buildBootstrapingService();		
	}

	/**
	 * 
	 */
	private void buildBootstrapingService() {
		bootstraping = new Bootstraping(BOOTSTRAPING_CYCLE_LENGTH, 
				bootstrapingView, pss, nsa);
	}
	
	public final Bootstraping getBootstraping() {
		return bootstraping;
	}
}
